<?php
$form = $this->form;
$session_list = $this->session_list;

$form->setAttribute ( 'action', $this->url ( NULL, array (
		'controller' => 'Index',
		'action' => 'process',
		'id' => $this->id 
) ) );
$form->prepare ();

/* $value = 0;
$option = array ();
foreach ( $session_list as $session ) {
	$value = $this->escapeHtml ( $session->TOPIC ); // 'name' name of the column in the database
	$id = $this->escapeHtml ( $session->ID );
	$option [] = array (
			'value' => $id,
			'label' => $value 
	);
}
$form->get ( 'SESSIONS' )->setAttributes ( array (
		'options' => $option 
) ); */
?>

<div class="container">
	<div class="row">
		<div class="col-md-10">
			<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">Add or Edit Events</h3>
				</div>

				<div class="panel-body">
				<?php echo $this->form()->openTag($form); ?>
				<?php				
                    $this->form->get ( 'ID' )->setValue ( $this->id );
    				echo $this->formelement ( $form->get ( 'ID' ) );
				?>
                    <div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('TITLE'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('TITLE'));?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('TITLE')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('DATE'));?></label>
						<div class="col-md-10">
							<div class="col-md-4" style="padding:0px">
                            	<?php   echo $this->formElement($form->get('DATE')); ?>
                            </div>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('DATE')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('SUBJECT'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('SUBJECT')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('SUBJECT')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('DESCRIPTION'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('DESCRIPTION')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('DESCRIPTION')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('PLACE'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('PLACE')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('PLACE')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('CATEGORY'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('CATEGORY')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('CATEGORY')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('SEATS'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('SEATS')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('SEATS')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"><?php echo $this->formlabel($form->get('EVENT_STATUS'));?></label>
						<div class="col-md-10">
                            <?php   echo $this->formElement($form->get('EVENT_STATUS')); ?>
                            <span class="errormsgform"><?php   echo $this->formElementErrors($form->get('EVENT_STATUS')); ?></span>
						</div>
					</div>

					<div class="form-group">
						<label class="col-md-2 control-label"></label>
						<div class="col-md-10">
                            <?php echo $this->formElement($form->get('BTNSAVE')); ?>
                            <?php //echo $this->formElement($form->get('BTNCLEAR')); ?>
                            <div class="btn btn-default">
								<a
									href="<?php echo $this->url('events',array('controller'=>'index'));?>"
									style="text-decoration: none; color: #413C3C">Cancel</a>
							</div>
						</div>
					</div>                  
                    
                <?php echo $this->form()->closeTag();?>
                </div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	$(document).ready(function(){
		$('#event_date').datepicker({ dateFormat: 'yy-mm-dd' });
	});
</script>
<script>
      $(function(){
        $("#geocomplete").geocomplete()
          .bind("geocode:result", function(event, result){
            $.log("Result: " + result.formatted_address);
          })
          .bind("geocode:error", function(event, status){
            $.log("ERROR: " + status);
          })
          .bind("geocode:multiple", function(event, results){
            $.log("Multiple: " + results.length + " results found");
          });
        
        $("#geocomplete").change(function(){
          $("#geocomplete").trigger("geocode");
        });        
        
        $("#examples a").click(function(){
          $("#geocomplete").val($(this).text()).trigger("geocode");
          return false;
        });
        
      });
    </script>
